<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
    <div id="app">
      <ul>
        <li v-for="(item,index) in users">
          {{item}}
        </li>
      </ul>
    
    </div>

    <script src="./node_modules/vue/dist/vue.js"></script>
    <script src="./node_modules/axios/dist/axios.js"></script>

    <script>
      // 1.还没有调用getAllUsers()方法

      let vm = new Vue({
        el: "#app",
        data(){
          return{
            users: []
          }
        },

        mounted(){
          this.getAllUsers();
        },

        methods:{
          getAllUsers(){
            axios.post('http://localhost:5527/decloud-topo/topo/getTopoList',
            {headers:{'Content-Type':'application/x-www-form-urlencoded; charset=UTF-8'}}
              //,{
              // params:{
              //   ID: 12345
              // }
              // }
            )

            // 当使用箭头函数时,this指向的是最外层
            .then(response => { //箭头函数
              console.log(response);
              this.users = response.data.data;
            })

            .catch(function(error){
              console.log(error);
            });

          }
        }
      });

    </script>

</body>
</html>